/**
 * 
 */
package com.fpt.edu.vn.h2tv.mapper;

import java.util.ArrayList;
import java.util.List;

import com.fpt.edu.vn.h2tv.dao.entity.TbShippingMethod;
import com.fpt.edu.vn.h2tv.dto.ShippingMethod;

/**
 * @author niteha
 *
 */
public class ShippingMethodMapper {

	private ShippingMethodMapper() {}

	public static ShippingMethod toDTO(TbShippingMethod shippingMethodPE) {

		if (shippingMethodPE == null) {
			return null;
		} else {
			ShippingMethod shippingMethodDTO = new ShippingMethod();
			shippingMethodDTO.setId(shippingMethodPE.getShippingmethodid());
			shippingMethodDTO.setMethod(shippingMethodPE.getShippingmethod());

			return shippingMethodDTO;
		}
	}

	public static List<ShippingMethod> toDTOList(List<TbShippingMethod> shippingMethodPEList) {

		if (shippingMethodPEList == null) {
			return new ArrayList<ShippingMethod>(0);
		} else {
			List<ShippingMethod> shippingMethodDTOList = new ArrayList<ShippingMethod>(shippingMethodPEList.size());
			ShippingMethod shippingMethodDTO;
			for (TbShippingMethod shippingMethodPE : shippingMethodPEList) {
				shippingMethodDTO = toDTO(shippingMethodPE);
				shippingMethodDTOList.add(shippingMethodDTO);
			}

			return shippingMethodDTOList;
		}
	}
}
